package com.bmps.springcloud.insuredmicroservice.callback.accept;
import com.bmps.springcloud.common.response.TaskResponseModel;
import com.bmps.springcloud.common.task.bean.RequestObject;
import com.bmps.springcloud.insuredmicroservice.model.accept.resquest.RequestModel;
import com.bmps.springcloud.insuredmicroservice.service.accept.HistoryVerificationService;
import java.util.concurrent.Callable;
/**
 * 历史核保任务
 * @author lyw
 * @date 2019-09-02 17:59:16
 */
public class HistoryVerificationCallBack implements Callable<TaskResponseModel> {

    private String key;

    private RequestObject requestObject;

    private final HistoryVerificationService historyVerificationService;

    public HistoryVerificationCallBack( String key, RequestObject requestObject,HistoryVerificationService historyVerificationService) {
        this.setKey(key);
        this.setRequestObject(requestObject);
        this.historyVerificationService = historyVerificationService;
    }

    private void setKey(String key) {
        this.key = key;
    }

    private void setRequestObject(RequestObject requestObject) {
        this.requestObject = requestObject;
    }

    /**
     * Computes a result, or throws an exception if unable to do so.
     * @return computed result
     */
    @Override
    public TaskResponseModel call() {
        return historyVerificationService.checkHistoryVerification(key, (RequestModel) requestObject.getParams());
    }
}
